package com.xiaoyu.izf.component;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.xiaoyu.izf.service.YqfDataGetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class SchedulerTask {
    @Autowired
    private YqfDataGetService yqfDataGetService;

    @Scheduled(cron = "0 15 0 * * ? ")
    public void yqfMerchantGet() {
        yqfDataGetService.merchantInfoGet();
    }

    @Scheduled(cron = "0 20 0 * * ? ")
    public void yqfStoreGet() {
        yqfDataGetService.storeGet();
    }

    @Scheduled(cron = "0 10 1 * * ? ")
    public void yqfDayDataGet() {
        DateTime dateTime = DateUtil.yesterday();
        yqfDataGetService.storeStateDayGet(dateTime.toSqlDate().toString());
    }

}
